package com.bawei.company

import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.bawei.base.mvvm.BaseActivity
import com.bawei.company.databinding.ActivityDetailBinding
import com.bumptech.glide.Glide
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
@Route(path = "/company/DetailActivity")
class DetailActivity : BaseActivity<ActivityDetailBinding,CompanyViewModel>() {
    @JvmField
    @Autowired
    var id=0
    override fun initView() {
        ARouter.getInstance().inject(this)
        viewModel.companyById(id)
        binding.addCompany.setOnClickListener {
            ARouter.getInstance().build("/company/AddCompanyActivity").navigation()
        }
    }

    override fun initData() {
        viewModel.companyByIdSuccess.observe(this){
            binding.companyArea.text="企业地址：${it.address}"
            binding.companyName.text="企业名称："+it.name
            binding.companyPhone.text="联系方式:"+it.contactInfo
            binding.companyPerson.text="法人代表:"+it.legalRepresentative
            binding.companyIsUp.text="是否上市："+if (it.listed) "上市" else "未上市"
            binding.companyStatu.text="企业状态：${it.status}"
            binding.companyType.text="企业类型：${it.industryType}"
            binding.companyStock.text="股票名称：${it.stockName}"
            binding.companyStockNumber.text="股票名称：${it.stockCode}"
            Glide.with(this).load(R.drawable.img).into(binding.companyIcon)
        }
    }
}